var form = layui.form, layer = layui.layer, id=getQueryVariable("id"),productCode=parent.code,oldCode=getQueryVariable("oldCode");

var dw=getdictionary(3,10);//单位
var cgbz=getdictionary(5,14);//采购币种
var gys=getgys();
var dwselect=$("select[name='dw']");//单位列表
dwselect.append(getoption(dw));

var cgbzselect=$("select[name='cgbz']");//采购币种
cgbzselect.append(getoption(cgbz));


var gysselect=$("select[name='gys']");//供应商
gysselect.append(getoption(gys));

form.render();

//垫片种类中文描述
let moldCategoryCodeChineseDes = "";
//垫片种类英文描述
let moldCategoryCodeEnglishDes = "";

//垫片种类编码中文描述
let categoryCodeChineseDes = "";
//垫片种类编码英文描述
let categoryCodeEnglishDes = "";

//垫片耳朵中文描述
let firstCategoryCodeChineseDes = "";
//垫片耳朵英文描述
let firstCategoryCodeEnglishDes = "";

//垫片特殊参数中文描述
let secondaryCategoryCodeChineseDes = "";
//垫片特殊参数英文描述
let secondaryCategoryCodeEnglishDes = "";

//垫片尺寸中文描述
let threeCategoryCodeChineseDes = "";
//垫片尺寸英文描述
let threeCategoryCodeEnglishDes = "";

//印刷稿件3位简码中文描述
let craftCodeChineseDes = "";
//印刷稿件3位简码英文描述
let craftCodeEnglishDes = "";

//特殊需求(垫片)中文描述
let gasketSpecialNeedsChineseDes = "";
//特殊需求(垫片)英文描述
let gasketSpecialNeedsEnglishDes = "";

//修改
function updateData() {
    //表单初始值，修改时调用
    if(id!=""){
        var oldData =  parent.table.cache["producttableid"];
        $.each(oldData, function (index, value) {
            if (oldData[index]["id"] == id) {
                form.val("editor-form",{
                    "code":oldData[index]["code"],
                    "ge":oldData[index]["ge"],
                    "chinaRemark":oldData[index]["chinaRemark"],
                    "englishRemark":oldData[index]["englishRemark"],
                    "bzsm":oldData[index]["bzsm"],
                    "cpjz":oldData[index]["cpjz"],
                    "cpmz":oldData[index]["cpmz"],
                    "colour":oldData[index]["colour"],
                    "dw":oldData[index]["dw"],
                    "cgbz":oldData[index]["cgbz"],
                    "cgcb":oldData[index]["cgcb"],
                    "fob":oldData[index]["fob"],
                    "wbzc":oldData[index]["wbzc"],
                    "wbzk":oldData[index]["wbzk"],
                    "wbzg":oldData[index]["wbzg"],
                    "wbzcc":oldData[index]["wbzcc"],
                    "wbzsl":oldData[index]["wbzsl"],
                    "tj":oldData[index]["tj"],
                    "gys":oldData[index]["gys"],
                    "cshh":oldData[index]["cshh"],
                    "hq40zl":oldData[index]["hq40zl"],
                    "gp20":oldData[index]["gp20"],
                    "gp40":oldData[index]["gp40"],
                    "lclpx":oldData[index]["lclpx"],
                    "cgcbws":oldData[index]["cgcbws"],
                    "categoryCode":oldData[index]["categoryCode"],
                    "categoryName":oldData[index]["categoryName"],
                    "moldCategoryCode":oldData[index]["moldCategoryCode"],
                    "moldCategoryName":oldData[index]["moldCategoryName"],
                    "firstCategoryCode":oldData[index]["firstCategoryCode"],
                    "firstCategoryName":oldData[index]["firstCategoryName"],
                    "secondaryCategoryCode":oldData[index]["secondaryCategoryCode"],
                    "secondaryCategoryName":oldData[index]["secondaryCategoryName"],
                    "threeCategoryCode":oldData[index]["threeCategoryCode"],
                    "threeCategoryName":oldData[index]["threeCategoryName"],
                    "craftCode":oldData[index]["craftCode"],
                    "craftName":oldData[index]["craftName"],
                    "specialNeedsCode":oldData[index]["specialNeedsCode"],
                    "specialNeedsName":oldData[index]["specialNeedsName"]
                })
                form.render('select');
                //初始化中英文描述
                //垫片种类编码
                let categoryList = dictionaryCategoryList["categoryList"];
                for (let i in categoryList) {
                    if(oldData[index]["categoryCode"] === categoryList[i].code){
                        //垫片种类中文描述
                        moldCategoryCodeChineseDes = categoryList[i].remark;
                        //垫片种类英文描述
                        moldCategoryCodeEnglishDes = categoryList[i].englishname;
                    }
                }

                //垫片种类
                let moldCategoryList = dictionaryCategoryList["moldCategoryList"];
                for (let i in moldCategoryList) {
                    if(oldData[index]["moldCategoryCode"] === moldCategoryList[i].code){
                        //垫片种类编码中文描述
                        categoryCodeChineseDes = moldCategoryList[i].remark;
                        //垫片种类编码英文描述
                        categoryCodeEnglishDes = moldCategoryList[i].englishname;
                    }
                }

                //垫片耳朵
                let firstCategoryList = dictionaryCategoryList["firstCategoryList"];
                for (let i in firstCategoryList) {
                    if(oldData[index]["firstCategoryCode"] === firstCategoryList[i].code){
                        //垫片耳朵中文描述
                        firstCategoryCodeChineseDes = firstCategoryList[i].remark;
                        //垫片耳朵英文描述
                        firstCategoryCodeEnglishDes = firstCategoryList[i].englishname;
                    }
                }

                //垫片特殊参数
                let secondaryCategoryList = dictionaryCategoryList["secondaryCategoryList"];
                for (let i in secondaryCategoryList) {
                    if(oldData[index]["secondaryCategoryCode"] === secondaryCategoryList[i].code){
                        //垫片特殊参数中文描述
                        secondaryCategoryCodeChineseDes = secondaryCategoryList[i].remark;
                        //垫片特殊参数英文描述
                        secondaryCategoryCodeEnglishDes = secondaryCategoryList[i].englishname;
                    }
                }

                //垫片尺寸
                let threeLevelCategoryList = dictionaryCategoryList["threeLevelCategoryList"];
                for (let i in threeLevelCategoryList) {
                    if(oldData[index]["threeCategoryCode"] === threeLevelCategoryList[i].code){
                        //垫片尺寸中文描述
                        threeCategoryCodeChineseDes = threeLevelCategoryList[i].remark;
                        //垫片尺寸英文描述
                        threeCategoryCodeEnglishDes = threeLevelCategoryList[i].englishname;
                    }
                }

                //印刷稿件3位简码
                let craftList = dictionaryCategoryList["craftList"];
                for (let i in craftList) {
                    if(oldData[index]["craftCode"] === craftList[i].code){
                        //印刷稿件3位简码中文描述
                        craftCodeChineseDes = craftList[i].remark;
                        //印刷稿件3位简码英文描述
                        craftCodeEnglishDes = craftList[i].englishname;
                    }
                }

                //特殊需求(垫片)
                let specialNeedsList = dictionaryCategoryList["specialNeedsList"];
                for (let i in specialNeedsList) {
                    if(oldData[index]["specialNeedsCode"] === specialNeedsList[i].code){
                        //特殊需求(垫片)中文描述
                        gasketSpecialNeedsChineseDes = specialNeedsList[i].remark;
                        //特殊需求(垫片)英文描述
                        gasketSpecialNeedsEnglishDes = specialNeedsList[i].englishname;
                    }
                }
            }
        });
        form.render();
    }else {
        $("#wbzg").val(0);
        $("#cpjz").val(0);
        $("#cpmz").val(0);
        $("#wbzc").val(0);
        $("#wbzk").val(0);
        $("#wbzsl").val(0);
        $("#tj").val(0);
        $("#hq40zl").val(0);
        $("#gp20").val(0);
        $("#gp40").val(0);
        $("#lclpx").val(0);
        $("#cgcb").val(0);
        $("#fob").val(0);
        $("#wbzcc").val(0);
        $("#cgcbws").val(0);
        $("#cshh").val(0);

    }
}
//监听提交
form.on('submit(form-element)', function(data){
    //data.field 为表单修改或新增数据 变量ID有值的情况下是修改，否则为新增
    if(savefj(data.field)){
        layer.msg("保存成功", {icon: 6});
        parent.refrash();
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }

    return false;
});
function savefj(data) {
    if(id !="") data.id=id;
    data.productCode=productCode;
    data.oldCode=oldCode;
    var tf=false;
    $.ajax({
        type : 'post',
        data:JSON.stringify(data),
        url:'productfjinfo/savefj',
        dataType:"json",
        contentType: 'application/json',
        async:false,
        success : function (da) {
            if(da.status==200 ){
                tf= da.data >0 ;
            }else {
                layer.msg(da.msg, {icon: 5});
            }
        }
    });
    return tf;
}
//获取所有供应商
function  getgys() {
    var gys=[];
    $.ajax({
        type : 'get',
        url:'customer2/getAllGys',
        dataType:"json",
        async:false,
        success : function (da) {
            if(da.status==200 ){
                for(var i=0;i<da.data.length;i++){
                    var obj={};
                    obj.code=da.data[i].code;
                    obj.name=da.data[i].name;
                    gys.push(obj);
                }

            }
        }
    });
    return gys;
}
function  getoption(objs) {
    var stoptions="<option value=''></option>";
    for(var i=0;i<objs.length;i++){
        stoptions+="<option value='"+objs[i].code+"'>"+objs[i].name+"</option>";
    }
    return stoptions;
}
function isNumber(val) {
    var regPos = /^\d+(\.\d+)?$/; //非负浮点数
    var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
    if (regPos.test(val) || regNeg.test(val)) {
        return true;
    } else {
        return false;
    }
}
//计算未含税出厂价
function changecgcb(){
    //含税出厂价
    let cgcb=$("#cgcb").val();
    let cgcbBig
    if (isNumber(cgcb)){
        cgcbBig=new BigNumber(cgcb);
    }else{
        cgcbBig=new BigNumber(0);
    }
    let cgcbws=cgcbBig.dividedBy(1.3).toFixed(3);
    $("#cgcbws").val(cgcbws);
    form.render();
}

//计算未含税FOB价格
function changeFob(){
    //含税出厂价
    let fob=$("#fob").val();
    let fobBig
    if (isNumber(fob)){
        fobBig=new BigNumber(fob);
    }else{
        fobBig=new BigNumber(0);
    }
    let cshh=fobBig.dividedBy(1.3).toFixed(3);
    $("#cshh").val(cshh);
    form.render();
}

//模具相关信息
let dictionaryCategoryList = [];

layer.ready(function () {
    //获取配件模具字典信息
    $.ajax({
        url: "product/category/getPartsDictionaryCategory",
        async: false,
        success: function (data) {
            if (data.status == 200) {
                dictionaryCategoryList = data.data;
                //垫片种类编码
                let categoryList = dictionaryCategoryList["categoryList"];
                for (let i in categoryList) {
                    $("#categoryCode").append(new Option(categoryList[i].name, categoryList[i].code));
                }

                //垫片种类
                let moldCategoryList = dictionaryCategoryList["moldCategoryList"];
                for (let i in moldCategoryList) {
                    $("#moldCategoryCode").append(new Option(moldCategoryList[i].name, moldCategoryList[i].code));
                }

                //垫片耳朵
                let firstCategoryList = dictionaryCategoryList["firstCategoryList"];
                for (let i in firstCategoryList) {
                    $("#firstCategoryCode").append(new Option(firstCategoryList[i].name, firstCategoryList[i].code));
                }

                //垫片特殊参数
                let secondaryCategoryList = dictionaryCategoryList["secondaryCategoryList"];
                for (let i in secondaryCategoryList) {
                    $("#secondaryCategoryCode").append(new Option(secondaryCategoryList[i].name, secondaryCategoryList[i].code));
                }

                //垫片尺寸
                let threeLevelCategoryList = dictionaryCategoryList["threeLevelCategoryList"];
                for (let i in threeLevelCategoryList) {
                    $("#threeCategoryCode").append(new Option(threeLevelCategoryList[i].name, threeLevelCategoryList[i].code));
                }

                //印刷稿件3位简码
                let craftList = dictionaryCategoryList["craftList"];
                for (let i in craftList) {
                    $("#craftCode").append(new Option(craftList[i].name, craftList[i].code));
                }

                //特殊需求(垫片)
                let specialNeedsList = dictionaryCategoryList["specialNeedsList"];
                for (let i in specialNeedsList) {
                    $("#specialNeedsCode").append(new Option(specialNeedsList[i].name, specialNeedsList[i].code));
                }

                form.render('select');
            }
        }
    });

    //修改
    updateData();
});


//监听垫片种类编码下拉框
form.on("select(categoryCode)", function(data){
    if(data.value === ""){
        $("#categoryName").val("");
        return;
    }
    let categoryList = dictionaryCategoryList["categoryList"];
    for(let i in categoryList){
        if(categoryList[i].code == data.value){
            categoryCodeChineseDes = categoryList[i].remark;
            categoryCodeEnglishDes = categoryList[i].englishname;
            let categoryName = categoryList[i].name;
            $("#categoryName").val(categoryName);
            //垫片种类编码和垫片种类联动:编码=编码
            //垫片种类编码编码(取序列号)
            let categoryCode = data.value.substring(data.value.indexOf("-") + 1, data.value.length)
            //垫片种类
            let moldCategoryList = dictionaryCategoryList["moldCategoryList"];
            for (let j in moldCategoryList) {
                //垫片种类编码(取序列号)
                let moldCategoryCode = moldCategoryList[j].code.substring(moldCategoryList[j].code.indexOf("-") + 1, moldCategoryList[j].code.length)
                if(categoryCode === moldCategoryCode){
                    //序列号相等, 默认自动勾选
                    moldCategoryCodeChineseDes = moldCategoryList[j].remark;
                    moldCategoryCodeEnglishDes = moldCategoryList[j].englishname;
                    $("#moldCategoryName").val(moldCategoryList[j].name);
                    $("#moldCategoryCode").val(moldCategoryList[j].code);
                }
            }
            let newSpecCode = getNewSpecCode();
            $("#code").val(newSpecCode);
            //新的中文描述
            let newChineseDes = getNewChineseDes();
            $("#chinaRemark").val(newChineseDes);
            //新的英文描述
            let newEnglishDes = getNewEnglishDes();
            $("#englishRemark").val(newEnglishDes);
            break;
        }
    }
    form.render();
});


//监听垫片种类下拉框
form.on("select(moldCategoryCode)", function(data){
    if(data.value === ""){
        $("#moldCategoryName").val("");
        return;
    }
    let moldCategoryList = dictionaryCategoryList["moldCategoryList"];
    for(let i in moldCategoryList){
        if(moldCategoryList[i].code == data.value){
            moldCategoryCodeChineseDes = moldCategoryList[i].remark;
            moldCategoryCodeEnglishDes = moldCategoryList[i].englishname;
            $("#moldCategoryName").val(moldCategoryList[i].name);
            //垫片种类编码和垫片种类联动:编码=编码
            //垫片种类编码(取序列号)
            let moldCategoryCode = data.value.substring(data.value.indexOf("-") + 1, data.value.length)
            //垫片种类编码
            let categoryList = dictionaryCategoryList["categoryList"];
            for (let j in categoryList) {
                //垫片种类编码编码(取序列号)
                let categoryCode = categoryList[j].code.substring(categoryList[j].code.indexOf("-") + 1, categoryList[j].code.length)
                if(categoryCode === moldCategoryCode){
                    //序列号相等, 默认自动勾选
                    categoryCodeChineseDes = categoryList[j].remark;
                    categoryCodeEnglishDes = categoryList[j].englishname;
                    $("#categoryName").val(categoryList[j].name);
                    $("#categoryCode").val(categoryList[j].code);
                }
            }
            let newSpecCode = getNewSpecCode();
            $("#code").val(newSpecCode);
            //新的中文描述
            let newChineseDes = getNewChineseDes();
            $("#chinaRemark").val(newChineseDes);
            //新的英文描述
            let newEnglishDes = getNewEnglishDes();
            $("#englishRemark").val(newEnglishDes);
            break;
        }
    }
    form.render();
});


//监听垫片耳朵下拉框
form.on("select(firstCategoryCode)", function(data){
    if(data.value === ""){
        $("#firstCategoryName").val("");
        return;
    }
    let firstCategoryList = dictionaryCategoryList["firstCategoryList"];
    for(let i in firstCategoryList){
        if(firstCategoryList[i].code == data.value){
            firstCategoryCodeChineseDes = firstCategoryList[i].remark;
            firstCategoryCodeEnglishDes = firstCategoryList[i].englishname;
            $("#firstCategoryName").val(firstCategoryList[i].name);
            let newSpecCode = getNewSpecCode();
            $("#code").val(newSpecCode);
            //新的中文描述
            let newChineseDes = getNewChineseDes();
            $("#chinaRemark").val(newChineseDes);
            //新的英文描述
            let newEnglishDes = getNewEnglishDes();
            $("#englishRemark").val(newEnglishDes);
            break;
        }
    }
});


//监听垫片特殊参数下拉框
form.on("select(secondaryCategoryCode)", function(data){
    if(data.value === ""){
        $("#secondaryCategoryName").val("");
        return;
    }
    let secondaryCategoryList = dictionaryCategoryList["secondaryCategoryList"];
    for(let i in secondaryCategoryList){
        if(secondaryCategoryList[i].code == data.value){
            secondaryCategoryCodeChineseDes = secondaryCategoryList[i].remark;
            secondaryCategoryCodeEnglishDes = secondaryCategoryList[i].englishname;
            $("#secondaryCategoryName").val(secondaryCategoryList[i].name);
            let newSpecCode = getNewSpecCode();
            $("#code").val(newSpecCode);
            //新的中文描述
            let newChineseDes = getNewChineseDes();
            $("#chinaRemark").val(newChineseDes);
            //新的英文描述
            let newEnglishDes = getNewEnglishDes();
            $("#englishRemark").val(newEnglishDes);
            break;
        }
    }
});


//监听垫片尺寸下拉框
form.on("select(threeCategoryCode)", function(data){
    if(data.value === ""){
        $("#threeCategoryName").val("");
        return;
    }
    let threeLevelCategoryList = dictionaryCategoryList["threeLevelCategoryList"];
    for(let i in threeLevelCategoryList){
        if(threeLevelCategoryList[i].code == data.value){
            threeCategoryCodeChineseDes = threeLevelCategoryList[i].remark;
            threeCategoryCodeEnglishDes = threeLevelCategoryList[i].englishname;
            $("#threeCategoryName").val(threeLevelCategoryList[i].name);
            let newSpecCode = getNewSpecCode();
            $("#code").val(newSpecCode);
            //新的中文描述
            let newChineseDes = getNewChineseDes();
            $("#chinaRemark").val(newChineseDes);
            //新的英文描述
            let newEnglishDes = getNewEnglishDes();
            $("#englishRemark").val(newEnglishDes);
            break;
        }
    }
});


//监听印刷稿件3位简码下拉框
form.on("select(craftCode)", function(data){
    if(data.value === ""){
        $("#craftName").val("");
        return;
    }
    let craftList = dictionaryCategoryList["craftList"];
    for(let i in craftList){
        if(craftList[i].code == data.value){
            craftCodeChineseDes = craftList[i].remark;
            craftCodeEnglishDes = craftList[i].englishname;
            $("#craftName").val(craftList[i].name);
            let newSpecCode = getNewSpecCode();
            $("#code").val(newSpecCode);
            //新的中文描述
            let newChineseDes = getNewChineseDes();
            $("#chinaRemark").val(newChineseDes);
            //新的英文描述
            let newEnglishDes = getNewEnglishDes();
            $("#englishRemark").val(newEnglishDes);
            break;
        }
    }
});

//监听特殊需求设置(垫片)下拉框
form.on("select(specialNeedsCode)", function(data){
    if(data.value === ""){
        $("#specialNeedsName").val("");
        return;
    }
    let specialNeedsList = dictionaryCategoryList["specialNeedsList"];
    for(let i in specialNeedsList){
        if(specialNeedsList[i].code == data.value){
            gasketSpecialNeedsChineseDes = specialNeedsList[i].remark;
            gasketSpecialNeedsEnglishDes = specialNeedsList[i].englishname;
            $("#specialNeedsName").val(specialNeedsList[i].name);
            let newSpecCode = getNewSpecCode();
            $("#code").val(newSpecCode);
            //新的中文描述
            let newChineseDes = getNewChineseDes();
            $("#chinaRemark").val(newChineseDes);
            //新的英文描述
            let newEnglishDes = getNewEnglishDes();
            $("#englishRemark").val(newEnglishDes);
            break;
        }
    }
});

//获取新的规格编码:垫片种类编码-垫片种类-垫片耳朵-垫片特殊参数-垫片尺寸-印刷稿件3位简码
function getNewSpecCode() {
    let newSpecCode = "";
    //垫片种类编码
    let categoryName = $("#categoryName").val();
    if (categoryName) {
        if(newSpecCode){
            newSpecCode = newSpecCode + "-" + categoryName;
        }else {
            newSpecCode = categoryName;
        }
    }
    //垫片种类
    let moldCategoryName = $("#moldCategoryName").val();
    if (moldCategoryName) {
        if(newSpecCode){
            newSpecCode = newSpecCode + "-" + moldCategoryName;
        }else {
            newSpecCode = moldCategoryName;
        }
    }
    //垫片耳朵
    let firstCategoryName = $("#firstCategoryName").val();
    if (firstCategoryName) {
        if(newSpecCode){
            newSpecCode = newSpecCode + "-" + firstCategoryName;
        }else {
            newSpecCode = firstCategoryName;
        }
    }
    //垫片特殊参数
    let secondaryCategoryName = $("#secondaryCategoryName").val();
    if (secondaryCategoryName) {
        if(newSpecCode){
            newSpecCode = newSpecCode + "-" + secondaryCategoryName;
        }else {
            newSpecCode = secondaryCategoryName;
        }
    }
    //垫片尺寸
    let threeCategoryName = $("#threeCategoryName").val();
    if (threeCategoryName) {
        if(newSpecCode){
            newSpecCode = newSpecCode + "-" + threeCategoryName;
        }else {
            newSpecCode = threeCategoryName;
        }
    }
    //印刷稿件3位简码
    let craftName = $("#craftName").val();
    if (craftName) {
        if(newSpecCode){
            newSpecCode = newSpecCode + "-" + craftName;
        }else {
            newSpecCode = craftName;
        }
    }
    //特殊需求(垫片)
    let specialNeedsName = $("#specialNeedsName").val();
    if (specialNeedsName) {
        if(newSpecCode){
            newSpecCode = newSpecCode + "-" + specialNeedsName;
        }else {
            newSpecCode = specialNeedsName;
        }
    }

    return newSpecCode;
}

//获取新的中文描述:所有中文描述以-拼接
function getNewChineseDes() {
    let newChineseDes = "";
    //垫片尺寸
    if (threeCategoryCodeChineseDes) {
        if(newChineseDes){
            newChineseDes = newChineseDes + "-" + threeCategoryCodeChineseDes;
        }else {
            newChineseDes = threeCategoryCodeChineseDes;
        }
    }
    //垫片种类
    if (moldCategoryCodeChineseDes) {
        if(newChineseDes){
            newChineseDes = newChineseDes + "-" + moldCategoryCodeChineseDes;
        }else {
            newChineseDes = moldCategoryCodeChineseDes;
        }
    }
    //垫片耳朵
    if (firstCategoryCodeChineseDes) {
        if(newChineseDes){
            newChineseDes = newChineseDes + "-" + firstCategoryCodeChineseDes;
        }else {
            newChineseDes = firstCategoryCodeChineseDes;
        }
    }
    //垫片特殊参数
    if (secondaryCategoryCodeChineseDes) {
        if(newChineseDes){
            newChineseDes = newChineseDes + "-" + secondaryCategoryCodeChineseDes;
        }else {
            newChineseDes = secondaryCategoryCodeChineseDes;
        }
    }
    //印刷稿件3位简码
    if (craftCodeChineseDes) {
        if(newChineseDes){
            newChineseDes = newChineseDes + "-" + craftCodeChineseDes;
        }else {
            newChineseDes = craftCodeChineseDes;
        }
    }
    //特殊需求(垫片)
    if (gasketSpecialNeedsChineseDes) {
        if(newChineseDes){
            newChineseDes = newChineseDes + "-" + gasketSpecialNeedsChineseDes;
        }else {
            newChineseDes = gasketSpecialNeedsChineseDes;
        }
    }

    return newChineseDes;
}

//获取新的英文描述:所有英文描述以-拼接
function getNewEnglishDes() {
    let newEnglishDes = "";
    //垫片尺寸
    if (threeCategoryCodeEnglishDes) {
        if(newEnglishDes){
            newEnglishDes = newEnglishDes + "-" + threeCategoryCodeEnglishDes;
        }else {
            newEnglishDes = threeCategoryCodeEnglishDes;
        }
    }
    //垫片种类
    if (moldCategoryCodeEnglishDes) {
        if(newEnglishDes){
            newEnglishDes = newEnglishDes + "-" + moldCategoryCodeEnglishDes;
        }else {
            newEnglishDes = moldCategoryCodeEnglishDes;
        }
    }
    //垫片耳朵
    if (firstCategoryCodeEnglishDes) {
        if(newEnglishDes){
            newEnglishDes = newEnglishDes + "-" + firstCategoryCodeEnglishDes;
        }else {
            newEnglishDes = firstCategoryCodeEnglishDes;
        }
    }
    //垫片特殊参数
    if (secondaryCategoryCodeEnglishDes) {
        if(newEnglishDes){
            newEnglishDes = newEnglishDes + "-" + secondaryCategoryCodeEnglishDes;
        }else {
            newEnglishDes = secondaryCategoryCodeEnglishDes;
        }
    }
    //印刷稿件3位简码
    if (craftCodeEnglishDes) {
        if(newEnglishDes){
            newEnglishDes = newEnglishDes + "-" + craftCodeEnglishDes;
        }else {
            newEnglishDes = craftCodeEnglishDes;
        }
    }
    //特殊需求(垫片)
    if (gasketSpecialNeedsEnglishDes) {
        if(newEnglishDes){
            newEnglishDes = newEnglishDes + "-" + gasketSpecialNeedsEnglishDes;
        }else {
            newEnglishDes = gasketSpecialNeedsEnglishDes;
        }
    }

    return newEnglishDes;
}